package com.example.myapplication.ui.self;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.myapplication.pojo.SingleUser;

public class SelfViewModel extends ViewModel {

    private MutableLiveData<String> name;
    private MutableLiveData<String> password;
    private MutableLiveData<Integer> age;

    public MutableLiveData<String> getName() {
        if(name==null){
            name=new MutableLiveData<>();
            name.setValue("账户： "+SingleUser.getInstance().getUser().getName());
        }
        return name;
    }

    public void setName(MutableLiveData<String> name) {
        this.name = name;
    }

    public MutableLiveData<String> getPassword() {
        if(password==null){
            password=new MutableLiveData<>();
            password.setValue("密码： "+SingleUser.getInstance().getUser().getPassword());
        }
        return password;
    }

    public void setPassword(MutableLiveData<String> password) {
        this.password = password;
    }

    public MutableLiveData<Integer> getAge() {
        if (age==null){
            age=new MutableLiveData<>();
            age.setValue(SingleUser.getInstance().getUser().getAge());
        }
        return age;
    }

    public void setAge(MutableLiveData<Integer> age) {
        this.age = age;
    }
}